package com.fei.springcloud.controller;

import com.fei.springcloud.pojo.Dept;
import com.fei.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: csp1999
 * @Date: 2020/05/17/22:44
 * @Description:
 */
@RestController
//@RequestMapping("/consumer")
public class DeptConsumerController {
    @Resource
    private DeptClientService deptClientService;
    /**
     * 消费方添加部门信息
     * @param dept
     * @return
     */
    @PostMapping("/dept/addDept")
    public boolean add(Dept dept) {
        return this.deptClientService.addDept(dept);
    }
    /**
     * 消费方根据id查询部门信息
     * @param id
     * @return
     */
    @GetMapping("/dept/queryById/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return this.deptClientService.queryById(id);
    }
    /**
     * 消费方查询部门信息列表
     * @return
     */
    @GetMapping("/dept/queryAll")
    public List<Dept> list() {
        return this.deptClientService.queryAll();
    }
}
